<template>
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="content">学校场所详情</block>
			</cu-custom>

			<view class="content">
				<view class="top">
					<span>{{formData.schoolTypeText}}</span>
					<span v-if="formData.checkId != '' && formData.checkId != null"><button class="share-now"
							:data-id="formData.checkId" open-type="share">分享页面</button></span>
				</view>
				<view class="bottom">
					<view class="span">{{formData.checkNum}}
						<view class="text">隐患数</view>
					</view>
					<view class="span">{{formData.rectifyNum}}
						<view class="text">已整改</view>
					</view>
					<view class="span">{{formData.daiNum}}
						<view class="text">待整改</view>
					</view>
				</view>

			</view>
			<view class="secondContent">
				<view class="h6">{{formData.schoolName}}</view>
				<view class="ul">
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">学校编号<span>{{formData.schoolCode == null ? '' : formData.schoolCode}}</span></view>
										<view class="li animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">所属镇街<span>{{formData.town == null ? '' : formData.town}}</span></view>
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">详细地址<span>{{formData.address == null ? '' : formData.address}}</span></view>
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.4s'}]">负责人<span>{{formData.principalName == null ? '' : formData.principalName}} ({{formData.principalPhone == null ? '' : formData.principalPhone}})</span></view>
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.5s'}]">学校类型<span>{{formData.schoolTypeText == null ? '' : formData.schoolTypeText}}</span></view>
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.6s'}]">
						排查状态<span>{{formData.checkStatus == 0 ? '未完成' : '已完成'}}排查<view class="span"
								v-if="formData.checkStatus != 0">
								({{formData.checkTime == null ? '' : formData.checkTime}})</view></span></view>
					<view class="li animation-slide-bottom" :style="[{animationDelay: '0.7s'}]">
						排查员：<span>{{formData.checkBy == null ? '' : formData.checkBy}}<view class="span" v-if="formData.checkPhone != null && formData.checkPhone != ''">({{formData.checkPhone == null ? '' : formData.checkPhone}})</view></span></view>
				</view>
			</view>
			<view class="chosecard">
				<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
					activeColor="#4cd964"></uni-segmented-control>
			</view>

			<view class="qingkuan">
				<view v-show="current === 0" class="one">
					<view class="label">
						<span @click="clickdangerStr(item)" :class="item.class" v-for="(item,index) in dangerStr"
							:key="index">{{item.text}}</span>
					</view>
					<view class="qianphotobox" v-if="formData.checkId == '' || formData.checkId == null">
						尚未进行排查，请先开始排查！
					</view>
					<view class="detaliy" v-if="formData.checkId != '' && formData.checkId != null">
						<view class="h6">隐患清单[{{dangerSize}}条]</view>
						<view class="serh">
							<uni-search-bar placeholder="请输入隐患关键字" @confirm="search" v-model="dangerDesc">
							</uni-search-bar>
							<view class="saix">
								筛选:
								<mySelect v-model="operation" placeholder="请选择场所类型"
									dictCode="agenda_status" space></mySelect>
							</view>
						</view>
						<empty v-if="formlist.length == 0"></empty>
						<view class="listdetail">
							<view class="li animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in formlist" @click="gotoDetail(item)">
								<view class="listtop margin-bottom">
									<span>{{item.createBy}}</span>
									<span>{{item.createTime}}</span>
								</view>

								<text class="margin-bottom">{{item.dangerDesc == null ? '' : item.dangerDesc}}</text>
								<view class="middle_img">
									<view class="Colt_center_middleImg" v-for="(items,i) in item.photoList" :key="i">
										<view class="img_wapBox">
											<image class="imag" :src="items.url" mode="aspectFill"
												@click.stop="photoPreview(item.photoList,i)"></image>
										</view>
									</view>
								</view>
								<!-- 	<view class="imglist ">
									<image :src="items.url" mode="aspectFill" v-for="(items,i) in item.photoList"
										:key="i"></image>
								</view> -->
								<view class="label margin-bottom">{{item.detailDesc  == null ? '' : item.detailDesc}}</view>
								<view class="listbottom margin-bottom">
									<view class="jibie">{{item.levelText == null ? '' : item.levelText}}</view>
									<view class="zheng">{{item.status == 0 ? '未整改' : '已整改'}}</view>
									<view class="zheng margin-right blue" v-if="item.operation != null">{{item.operation == null ? '' : item.operation}}</view>
								</view>

							</view>
						</view>
					</view>
					<!-- <navigator class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.3s'}]" url="/pages/education/detaillist?scene=1504787772253552642" hover-class="none">
						<view class="content" >
						    <text class="cuIcon-exit text-cyan"></text>
							<text class="text-grey">跳转</text>
						</view>
					</navigator> -->
					<view class="miniQrbox" v-if="formData.miniQr != null && formData.miniQr != ''">
						<view class="span">隐患告知书二维码（长按转发）</view>
						<image class="miniQr" @click="remPreview(formData.miniQr)" mode="widthFix"
							:src="formData.miniQr"></image>
					</view>
				</view>
				<view v-show="current === 1">
					<view class="qianphotobox" v-if="formData.checkId == '' || formData.checkId == null">
						尚未进行排查，请先开始排查！
					</view>
					<view class="qianphoto" v-if="formData.checkId != '' && formData.checkId != null">
						<view class="h6">场所负责人签名：</view>
						<view class="h5" v-if="wordData.principalSign == null || wordData.principalSign == ''"
							@click="openQm">签名照片</view>
						<view class="qmyphoto" v-if="wordData.principalSign != null && wordData.principalSign != ''">
							<image mode="widthFix" :src="wordData.principalSign"></image>
						</view>
						<autograph @getImg="getImg" @colse="colse" v-show="isShow" ref="QM" class="QMstyle"></autograph>
						<view class="h6">负责人签收照片：</view>
						<!-- 						<view class="h5">上传签收照片</view> -->
						<view class="fzrphoto" v-if="wordData.principalReceipt == null || wordData.principalReceipt == ''">
							<uni-file-picker disable-preview :del-icon="false" return-type="object" @select="selectfzr"
								@delete="deLetefzr">上传签收照片
							</uni-file-picker>
						</view>
						<image :src="wordData.principalReceipt"
							v-if="wordData.principalReceipt != null && wordData.principalReceipt != ''" mode="widthFix">
						</image>
					</view>
					<view class="compenlist" v-if="formData.checkId != '' && formData.checkId != null">
						<view class="li">
							<view class="top">
								<view class="h6">{{wordData.status == 0 ? '排查中' : '已完成'}}</view>
								<view class="h5">{{wordData.createTime}}</view>
							</view>
							<view class="h3">
								<view class="midle">
									<image src="/static/banner/banner1.png" mode=""></image>
									<span>检查人员：{{wordData.createBy}}</span>
								</view>
								<text>流水号：{{wordData.serialNumber}}</text>
							</view>
							<view class="bottom">
								<span>新增隐患：{{wordData.checkNum}}</span>
								<span>复查隐患：{{wordData.reviewNum}}</span>
								<span>整改隐患：{{wordData.rectifyNum}}</span>
							</view>
							<view class="middle_img" v-if="wordData.workPhoto">
								<view class="Colt_center_middleImg">
									<view class="img_wapBox">
										<image class="imag" :src="wordData.workPhoto" mode="aspectFill"></image>
									</view>
								</view>
							</view>
							<uni-file-picker disable-preview :del-icon="false" return-type="object" @select="select"
								@delete="deLete" v-if="wordData.workPhoto == null || wordData.workPhoto == ''">上传照片
							</uni-file-picker>
							<view class="h1" @click="lookwodDetail(wordData.id)">查看详情</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 底部 -->
			<view class="fixedbottm">
				<view class="one">
					<view class="left" @click="godetail">
						<uni-icons type="compose" size="30"></uni-icons>
						<view class="span">更多学校信息</view>
					</view>
					<view @click="reportType" class="left" v-if="formData.checkStatus != 0">
						<uni-icons type="wallet" size="30"></uni-icons>
						<view class="span">打印</view>
					</view>
				</view>
				<block v-if="role == 'check' || role == 'admin' || role == 'checkauditor'">
					<view class="two" v-if="formData.checkId != '' && formData.checkId != null">
						<button v-if="formData.checkStatus != 0" class="cu-btn line-blue margin-right shadow" @tap="compCheck">隐患列表
						</button>
						<button class="cu-btn bg-blue margin-right shadow" @tap="addYin">新增隐患
						</button>
					</view>
					<view class="three" v-if="formData.checkId == '' || formData.checkId == null">
						<view class="span" @click="apicheckadd">隐患排查</view>
					</view>
				</block>
			</view>

			<!-- 未处理隐患弹框 -->
			<uni-popup ref="bottompopup" type="bottom" :mask-click="true">
				<view class="scortop">
					<view class="title">{{propstitle}}</view>
					<uni-icons type="close" size="30" @click="compclose"></uni-icons>
				</view>
				<view class="scrollbox">
					<view class="listdetail" v-if="propstitle == '未处理隐患'">
						<view class="li animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in propsFormlist" @click="gotoDetail(item)">
							<view class="listtop margin-bottom">
								<span>{{item.createBy}}</span>
								<span>{{item.createTime}}</span>
							</view>

							<text class="margin-bottom">{{item.dangerDesc}}</text>
							<view class="imglist margin-bottom">
								<image :src="items.url" mode="aspectFill" v-if="item.photoList.length != 0"
									v-for="(items,i) in item.photoList" :key="i"></image>
							</view>
							<view class="label margin-bottom">{{item.detailDesc == null ? '' : item.detailDesc}}</view>
							<view class="listbottom margin-bottom">
								<view class="zheng">{{item.status == 0 ? '未整改' : '已整改'}}</view>
								<view class="zheng margin-right blue" v-if="item.operation != null">{{item.operation == null ? '' : item.operation}}</view>
							</view>

						</view>
					</view>
					<view class="titlecontent" v-if="propstitle == '场所完成排查'">
						<view>已完成所有排查</view>
						<!-- <view class="h6">检查标准</view>
						<uni-file-picker v-model="imageValue" fileMediatype="image" mode="grid" @select="qinselect"
							@progress="progress" @delete="qindeLete" @success="success" @fail="fail" />
						<view class="padding flex flex-direction">
							<button class="cu-btn bg-blue lg shadow" @click="photoAdd">提交</button>
						</view> -->
					</view>
				</view>
			</uni-popup>
			
			<!-- 选择打印报告类型 -->
			<uni-popup ref="reportshow" type="bottom" :mask-click="true">
				<view class="scortop">
					<view class="title">选择报告类型</view>
					<!-- <uni-icons type="close" size="30" @click="compclose"></uni-icons> -->
				</view>
				<view class="padding text-center">
					<button class="cu-btn line-blue lg margin-right shadow" @click="print(0)">检查报告</button>
					 <button class="cu-btn bg-blue lg margin-left shadow" @click="print(1)">复查报告</button>
				</view>
				
			</uni-popup>
			
			
			<!-- 填写项目信息 -->
			<navigator v-if="formData.checkStatus != 0 && role != 'client'" class="information" :url="'/pages/education/projectdetail?checkId=' + formData.checkId">
				<span>填写项目信息</span>
			</navigator>

		</scroll-view>
	</view>

</template>

<script>
	import {
		ACCESS_TOKEN
	} from '@/common/util/constants.js'
	import appSelect from '@/components/my-componets/appSelect.vue'
	import searchinput from '../component/searchinput.vue'
	import autograph from '../component/autograph.vue'
	import server from '@/api/server.js'
	import {
		community
	} from '@/common/util/work.js'
	const plan_type = [{
		text: '日常记录',
		value: '日常记录1'
	}, {
		text: '本周工作',
		value: '本周工作2'
	}, {
		text: '下周计划',
		value: '下周计划3'
	}];

	export default {
		components: {
			searchinput,
			autograph
		},
		data() {
			return {
				role:'admin',
				isShow: false,
				qmsrc: '',
				qmclose: false,
				items: ['隐患排查情况', '工作照片（签名）'],
				dangerStr: [],
				wordData: {},
				current: 0,
				community,
				plan_type,
				modalName: null,
				imageValue: [],
				myFormData: [],
				getid: null,
				// 表单数据
				formData: {},
				formlist: [],
				formlistcompet:[],
				dangerSize: 0,
				getid: null,
				propsFormlist: [],
				propstitle: '',
				dangerDesc: '',
				operation:'',
			}
		},
		watch:{
			// 监听下标的变化
			operation(val){
				console.log(val)
				this.search(val)
			}
		},
		onShow(options) {
			//options可以接到index 传过来的值
			this.getid = this.$root.$mp.query.id
			this.getdetail(this.getid)

		},
		onLoad(){
			// #ifdef MP-ALIPAY || MP-WEIXIN
				var pages = getCurrentPages(); // 当前页面
				var beforePage = pages[pages.length - 1]; // 前一个页面
				console.log(beforePage, 'beforePagebeforePagebeforePagebeforePagebeforePage')
				var url = beforePage.$page.fullPath;
				// if(url.indexOf("objectId") != -1){
				// 	uni.navigateTo({
				// 		// ? 后面加要传的参数， 多个参数用 & 隔开 
				// 		url: '/pages/education/dangerdetail?id=' + this.$root.$mp.query.objectId
				// 	})
				// }
			// #endif
		},
		mounted(){
			this.role = this.$store.getters.role
		},
		beforeDestroy() {
			uni.setStorageSync('education_dangerdetail', '')
		},
		onShareAppMessage: function(options) {
			// return eventHandler接收到的分享参数
			var that = this;
			// 设置菜单中的转发按钮触发转发事件时的转发内容
			var shareObj = {
				title: this.formData.schoolTypeText, // 默认是小程序的名称(可以写slogan等)
				path: '/pages/education/detaillist?scene=' + this.formData.checkId, // 默认是当前页面，必须是以‘/’开头的完整路径
				imageUrl: '', //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
				success: function(res) {
					// 转发成功之后的回调
					if (res.errMsg == 'shareAppMessage:ok') {}
				},
				fail: function() {
					// 转发失败之后的回调
					if (res.errMsg == 'shareAppMessage:fail cancel') {
						// 用户取消转发
					} else if (res.errMsg == 'shareAppMessage:fail') {
						// 转发失败，其中 detail message 为详细失败信息
					}
				},
				complete: function() {
					// 转发结束之后的回调（转发成不成功都会执行）
				}
			};
			// 来自页面内的按钮的转发
			if (options.from == 'button') {
				var eData = options.target.dataset;
				console.log(eData.id,1111111); // shareBtn
				// 此处可以修改 shareObj 中的内容
				shareObj.path = '/pages/education/detaillist?scene=' + eData.id;
			}
			// 返回shareObj
			　　return shareObj;
		},

		methods: {
			// 分享页面
			sharepage() {
				// return eventHandler接收到的分享参数
				return {
					title: '我发现了一家好店，快来看看吧！', // 分享名称
					path: 'pages/index/index', // 这里写你这个页面的路径
					imageUrl: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg', //这个是显示的图片，不写就默认当前页面的截图
					success: function(shareTickets) {
						console.log(shareTickets + '成功');
				  // 转发成功
					},
					fail: function(res) {
						console.log(res + '失败');
						// 转发失败
					},
				 complete: function(res) {
						// 不管成功失败都会执行
					}
				}
			},
			//图片预览
			photoPreview(data, index) {
				console.log(data)
				let photoList = data.map(item => {
					return item.url;
				});
				uni.previewImage({
					current: index,
					urls: photoList
				});
			},
			//弹出报告类型
			reportType(){
				this.$refs.reportshow.open('top')
			},
			//打印
			print(index) {
				var that = this
				server.schoolexport({
					id: this.$root.$mp.query.id,
					type:index
				}).then(res => {
					console.log(res)
					let base64 = wx.arrayBufferToBase64(res.data);
					let filePath = wx.env.USER_DATA_PATH + '/排查报告.pdf'
					console.log(filePath, '666666666666')
					const fileManager = wx.getFileSystemManager()
					this.$tip.loading();
					fileManager.writeFile({
						filePath: filePath,
						data: res.data,
						encoding: "binary",
						success: function(res) {
							console.log(filePath, res, '111111111111111111')
							that.$tip.loaded();
				
							wx.openDocument({
								filePath: filePath,
								showMenu: true,
								success: (e) => {
									console.log(e, '1')
									uni.showToast({
										title: `打开成功`
									})
								},
								fail: (e) => {
									console.log(e, '2')
									uni.showToast({
										title: `打开失败` + e
									})
								}
							})
						},
						fail: (e) => {
							console.log(e, '3')
							uni.showToast({
								title: `进入失败` + e
							})
						}
					})
				})
				
			},
			// 弹出签名
			openQm() {
				this.isShow = true;
			},
			//签名回调图片
			getImg(e) {
				this.qmsrc = e;
				this.isShow = false;
				this.qmclose = true;
				console.log(e)
				let object = {
					id: this.formData.checkId,
					principalSign: e,
				}
				server.schoolcheckedit(object).then(res => {
					console.log(res)
					this.getcheckqueryById()
				})
			},
			colse(e) {
				this.isShow = e;
			},
			//清除
			delImg() {
				uni.showToast({
					icon: 'none',
					duration: '3000',
					title: '签名已删除'
				})
				this.qmsrc = '';
				this.qmclose = false;
			},
			photoAdd() {
				let photoList = []
				let obj = {}
				this.myFormData.forEach(function(item) {
					obj.url = item
					obj.type = 1
					photoList.push(obj)
				})
				console.log(photoList)
				let object = {
					id: this.formData.checkId,
					photoList: photoList,
					status: 2,
				}
				server.schoolcheckedit(object).then(res => {
					console.log(res)
				})
			},

			// 获取上传状态
			qinselect(e) {
				var that = this
				console.log(this.imageValue)
				var tempFilePaths = []
				tempFilePaths = e.tempFilePaths
				tempFilePaths.forEach(function(item) {
					that.$http.upload(that.$config.apiUrl + '/sys/common/upload?biz=school', {
							filePath: item,
							name: 'file'
						})
						.then(res => {
							if(res.data.success){
								that.myFormData.push(res.data.message)
								that.$tip.success('上传成功！')
							}else{
								that.$tip.error('上传失败！')
							}
						})
						.catch(err => {
							that.$tip.error(err.data.message)
						});
				})


			},
			//完成复查
			compclose() {
				this.$refs.bottompopup.close()
			},
			compCheck() {
				this.$refs.bottompopup.open('top')
				let index = 0
				this.propsFormlist = []
				console.log(this.formlistcompet,'3456787654345676543')
				this.formlistcompet.forEach(item => {
					if (item.status == "0") {
						index++
						this.propsFormlist.push(item)
					}

				})

				if (index == 0) {
					this.propstitle = '场所完成排查'

				} else {
					this.propstitle = '未处理隐患'
					uni.showToast({
						title: '还有' + index + '项隐患未处理',
						duration: 2000,
						icon: 'none'
					});
				}

			},
			//上传签收照片（单张）
			putpcheckfzr() {
				let object = {
					id: this.formData.checkId,
					principalReceipt: this.wordData.principalReceipt,
				}
				server.schoolcheckedit(object).then(res => {
					console.log(res)
					this.getcheckqueryById()

				})
			},
			//上传照片（单张）
			putpcheckedit() {
				server.schoolcheckedit({
					id: this.formData.checkId,
					workPhoto: this.wordData.workPhoto
				}).then(res => {
					console.log(res)
					this.getcheckqueryById()

				})
			},
			// 获取上传状态
			selectfzr(e) {
				var that = this
				console.log(this.imageValue)
				var tempFilePaths = []
				tempFilePaths = e.tempFilePaths
				tempFilePaths.forEach(function(item) {
					that.$http.upload(that.$config.apiUrl + '/sys/common/upload?biz=school', {
							filePath: item,
							name: 'file'
						})
						.then(res => {
							console.log(res)
							if(res.data.success){
								that.wordData.principalReceipt = res.data.message
								that.putpcheckfzr()
								that.$tip.success('上传成功！')
							}else{
								that.$tip.error('上传失败！')
							}
						})
						.catch(err => {
							that.$tip.error(err.data.message)
						});
				})


			},
			// 获取上传状态
			select(e) {
				var that = this
				console.log(this.imageValue)
				var tempFilePaths = []
				tempFilePaths = e.tempFilePaths
				tempFilePaths.forEach(function(item) {
					that.$http.upload(that.$config.apiUrl + '/sys/common/upload?biz=school', {
							filePath: item,
							name: 'file'
						})
						.then(res => {
							console.log(res)
							if(res.data.success){
								that.wordData.workPhoto = res.data.message
								that.putpcheckedit()
								that.$tip.success('上传成功！')
							}else{
								that.$tip.error('上传失败！')
							}
							
						})
						.catch(err => {
							that.$tip.error(err.data.message)
						});
				})


			},
			//删除图片
			deLete(e) {
				console.log(e)
				server.dangerphoto(e.tempFile.name).then(res => {
					this.$nextTick(function() {
						console.log(res)
					});

				})
			},
			lookwodDetail(id) {
				uni.navigateTo({
					// ? 后面加要传的参数， 多个参数用 & 隔开 
					url: '/pages/education/dangerrecord?checkId=' + this.formData.checkId + '&id=' + id
				})
			},
			gotoDetail(item) {
				console.log(item)
				//本地存储
				try {
					uni.setStorageSync('education_dangerdetail', this.operation)
				} catch (e) {
					//错误
				}
				uni.navigateTo({
					// ? 后面加要传的参数， 多个参数用 & 隔开 
					url: '/pages/education/dangerdetail?id=' + item.id
				})
			},
			//隐患排查
			apicheckadd() {
				server.schoolcheckadd({
					schoolId: this.formData.id,
					status: 0
				}).then(res => {
					this.$nextTick(function() {
						console.log(res)
						this.formData.checkId = res.data.result.id
						uni.navigateTo({
							// ? 后面加要传的参数， 多个参数用 & 隔开 
							url: '/pages/education/troubleshooting?checkId=' + this
								.formData.checkId +
								'&checkNum=' + this.formData.checkNum + '&schoolName=' + this
								.formData.schoolName + '&checkStatus=' + this.formData.checkStatus
						})
					});

				})
			},
			//二维码单张放大
			remPreview(photoImg) {
				let imgsArray = [];
				imgsArray[0] = photoImg;
				uni.previewImage({
					current: 0,
					urls: imgsArray
				});
			},
			addYin() {
				uni.navigateTo({
					// ? 后面加要传的参数， 多个参数用 & 隔开 
					url: '/pages/education/troubleshooting?checkId=' + this
						.formData.checkId +
						'&checkNum=' + this.formData.checkNum + '&schoolName=' + this
						.formData.schoolName + '&checkStatus=' + this.formData.checkStatus
				})
			},
			godetail(id) {
				uni.navigateTo({
					// ? 后面加要传的参数， 多个参数用 & 隔开 
					url: '/pages/education/moreinformation?id=' + this.getid
				})
			},
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex;
				}
				if (this.current == 1) {
					this.getcheckqueryById()
				}
			},
			getcheckqueryById() {
				server.schoolcheckqueryById({
					id: this.formData.checkId
				}).then(res => {
					console.log(res)
					this.wordData = res.data.result

				})
			},
			getdetail(getid) {
				server.schoolqueryById(getid).then(res => {
					this.$nextTick(function() {
						console.log(res)
						this.formData = res.data.result
						this.formData.daiNum = res.data.result.checkNum - res.data.result.rectifyNum
						console.log(res.data.result.id)
						if (res.data.result.id) {
							if(uni.getStorageSync("education_dangerdetail") != ''){
								this.search(this.operation)
							}else{
								this.search()
							}

						}
					});

				})
			},
			search(type) {
				let obj = {}
				obj.checkId = this.formData.checkId
				obj.dangerDesc = this.dangerDesc
				if(type){
					obj.operation = this.operation
				}
				server.dangerlistByCheck(obj).then(res => {
					console.log(res)
					if(type){
						this.formlist = res.data.result
					}else{
						this.formlist = res.data.result
						this.formlistcompet = res.data.result
					}
					this.formlist = res.data.result
					this.dangerSize = this.formlist.length
					// if (res.data.result.dangerStr.length > 0) {
					// 	res.data.result.dangerStr.forEach(item => {
					// 		this.dangerStr.push({
					// 			text: item,
					// 			class: 'unselect'
					// 		})
					// 	})
					// }
				})
			},
			clickdangerStr(v) {
				v.class = v.class == 'unselect' ? 'select' : 'unselect'
				this.formlist.forEach(item => {
					item.show = false
				})
				let con = true;
				this.dangerSize = 0;
				this.dangerStr.forEach(danger => {
					if (danger.class == 'select') {
						this.formlist.forEach(item => {
							if (danger.text.substr(0, 1) == item.level) {
								item.show = true;
								this.dangerSize++;
							}
						})
						con = false;
					}
				})
				if (con) {
					this.formlist.forEach(item => {
						item.show = true
					})
					this.dangerSize = this.formlist.length

				}
			},
		}
	}
</script>

<style scoped lang="scss">
.uni-searchbar {
		background: white;
	}

	.content {
		padding: 10px 0;
		margin-bottom: 10px;
		background: red;
		color: white;
		float: left;
		width: 100%;

		.top {
			display: flex;
			justify-content: space-around;
			margin-bottom: 20px;
		}
	}



	.top span:nth-child(1) {
		padding: 0px 6px;
		border: 1px solid white;
		border-radius: 30px;
		font-size: 15px;

	}

	.top /deep/uni-button,
	.top /deep/button {
		font-size: 15px;
		padding: 0;
		margin: 0;
		line-height: 20px;
		background-color: unset;
		color: white;
	}

	.top /deep/uni-button::after,
	.top /deep/button::after {
		border: none;
		background-color: none;
	}

	.meid {
		font-size: 28px;
		font-weight: bold;
		height: 70px;
		display: flex;
		align-items: center;
		justify-content: center;

		span {
			border-bottom: 1px solid white;
			padding-bottom: 10px;
		}
	}

	.bottom {
		float: left;
		width: 100%;

		.span {
			text-align: center;
			float: left;
			width: 33.33%;
			font-size: 18px;

			.text {
				display: block;
			}
		}
	}

	.secondContent {
		background: white;
		padding: 10px 0;

		.h6 {
			font-size: 16px;
			color: blue;
			padding: 0 10px 0 10px;
		}

		.ul {
			padding: 0 10px;
			font-size: 15px;

			.li {
				font-size: 15px;
				margin-top: 10px;
				display: flex;
				align-items: center;

				span {
					margin-left: 10px;

					/deep/.cu-form-group .title {
						display: none;
					}

					.span {
						display: inline-block;
					}
				}
			}
		}
	}

	.chosecard {
		background: white;
	}

	.qingkuan {
		.select {
			border: 1px solid red;
			color: red !important;
		}

		.unselect {
			color: black !important;
		}

		.one {
			float: left;
			width: 100%;

			.label {
				float: left;
			}
		}

		.label {
			span {
				padding: 6px 10px;
				color: black;
				background: #efc5c5;
				border-radius: 30px;
				margin-right: 10px;
				float: left;
				margin: 5px;
			}
		}
	}

	.detaliy {
		.h6 {
			float: left;
			width: 100%;
			background: white;
			padding: 10px 0 10px 10px;
		}
	}

	.listdetail {
		float: left;
		padding-top: 5px;
		background: #f1f1f1;
		display: flex;
		flex-direction: column;
		.li {
			float: left;
			padding: 10px 5px;
			background: white;
			margin-bottom: 10px;
			margin: 0 5px 5px 5px;
			border-radius: 10px;

			.listtop {
				width: 100%;
				color: #969292;
				float: left;

				span:nth-child(2) {
					float: right;
				}
			}

			text {
				font-size: 15px;
			}

			uni-image {
				float: left;
				width: 124px;
				height: 80px;
				margin-right: 5px;
			}

			image {
				float: left;
				width: 124px;
				height: 80px;
				margin-right: 5px;
			}

			.label {
				font-size: 15px;
				color: #999;
			}

			.listbottom {
				.jibie {
					float: left;
				}

				.jibie,
				.zheng {
					border: 1px solid red;
					padding: 3px 8px;
					border-radius: 30px;
					color: red;
					&.blue{
						border: 1px solid blue;
						color: blue;
					}
				}

				.zheng {
					float: right;
				}
			}
		}
	}

	.margin-bottom {
		margin-bottom: 10px;
		float: left;
		width: 100%;
	}

	.fixedbottm {
		display: flex;
		padding: 10px 0;
		position: fixed;
		bottom: 0;
		width: 100%;
		background-color: white;

		.one {
			display: flex;
			justify-content: space-around;
			width: 40%;
			float: left;

			.label {
				float: left;
				width: 100%;
				padding: 5px;

			}

			.left {
				text-align: center;

				image {
					width: 25px;
					height: 25px;
				}

				uni-image {
					width: 25px;
					height: 25px;
				}

				.span {
					width: 100%;
					float: left;
				}
			}
		}

		.two {
			width: 60%;
			float: left;
			color: white;
			display: flex;
			align-items: center;
			justify-content: center;
			justify-content: space-evenly;

			.span {
				padding: 8px 9px;

				border-radius: 30px;
			}

			.span:nth-child(1) {
				background: blue;
			}

			.span:nth-child(2) {
				background: red;
			}
		}

		.three {
			width: 45%;
			float: left;
			color: white;
			display: flex;
			align-items: center;
			justify-content: center;
			justify-content: space-evenly;

			.span {
				padding: 8px 9px;

				border-radius: 30px;
			}

			.span:nth-child(1) {
				background: #f1b401;
				width: 100%;
				text-align: center;
			}
		}
	}

	.page,
	scroll-view {
		padding-bottom: 100px;
	}

	.qianphoto {
		padding: 10px;
		text-align: center;
		float: left;
		width: 100%;

		.qmyphoto {
			height: 200px;
			margin-bottom: 10px;
			background-color: white;
			display: flex;
			align-items: center;
			justify-content: center;

			uni-image,
			image {
				width: 150px;
				transform: rotate(-90deg);
				margin-bottom: 20px;
			}

		}

		.h6,
		.name {
			color: #999;
			font-size: 16px;
			margin-bottom: 20px;
			text-align: left;
		}

		.h5 {
			margin-bottom: 10px;
			font-size: 16px;
			color: #007aff;
		}


		.fuchaPhot {
			.h6 {
				color: #999;
				font-size: 14px;
				margin-bottom: 20px;
				float: left;
				width: 100%;
				text-align: left;
			}
		}
	}

	.compenlist {
		.li {
			background: white;
			border-radius: 15px;
			padding: 10px;
			float: left;
			width: 100%;

			.top {
				display: flex;
				justify-content: space-between;
				font-size: 18px;
				margin-bottom: 20px;

				.h6 {
					color: #007aff;
				}

				.h5 {
					color: #d372f1;
				}
			}

			.h3 {
				font-size: 16px;

				.midle {
					display: flex;
					align-items: center;
					margin-bottom: 10px;

					uni-image,
					image {
						width: 40px;
						height: 40px;
						border-radius: 30px;
						margin-right: 10px;
					}
				}

			}

			.bottom {
				display: flex;
				justify-content: space-between;
				font-size: 16px;
				color: #999;
				margin: 15px 0;
			}

			.imgcontent {
				width: 100%;
				display: block;

				uni-image,
				image {
					width: 85px;
					height: 85px;
				}
			}

			.h2 {
				margin-bottom: 10px;
				text-align: center;
				font-size: 18px;
				color: #007aff;
			}

			.h1 {
				text-align: center;
				border: 1px solid #666;
				padding: 8px 10px;
				width: 120px;
				border-radius: 30px;
				margin: 20px auto 0;
				display: inline-block;
				width: 100%;
			}
		}
	}

	.compenlist,
	.fzrphoto {
		/deep/.file-picker__box {
			width: 135px !important;
			height: 40px !important;
			padding-top: unset;
			text-align: center;
			padding: 8px 10px;
			width: 120px;
			border-radius: 30px;
			margin: 0 auto 0;
			border: unset !important;
			font-size: 16px;
			color: #007aff;

			.is-add {
				border-color: unset !important;
				border: unset !important;
			}
		}
	}



	//底部弹出框
	/deep/.uni-transition {
		background: white;
		border-top-left-radius: 15px;
		border-top-right-radius: 15px;
		overflow: hidden;

		.scrollbox {
			height: 500px;
			float: left;
			overflow: auto;
		}

		.scortop {
			padding: 10px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 18px;
			font-weight: bold;
			width: 100%;
		}
	}

	// 签名
	.textBox {
		width: 80%;
		padding: 20px;
		margin: 0 auto;
		margin-top: 50px;

		.name {
			float: left;
			height: 30px;
			line-height: 30px;
		}

		.show {
			width: 40%;
			height: 40px;
			float: left;
			margin-top: -10px;
			border-bottom: 1px solid #333;
			position: relative;

			.img {
				width: 40px;
				height: 123px;
				transform: rotate(-90deg);
				position: absolute;
				top: -48px;
				left: 38px;
				// image-rendering:-moz-crisp-edges;
				// image-rendering:-o-crisp-edges;
				// image-rendering:-webkit-optimize-contrast;
				// image-rendering: crisp-edges;
				// -ms-interpolation-mode:nearest-neighbor;
			}
		}

		.iconfont {
			float: left;
			font-size: 24px;
			margin-top: 4px;
			color: #3967FF;
			margin-left: 10px;
		}
	}

	.QMstyle {
		position: fixed;
		z-index: 99999;
		top: 0;
		left: 0;
	}

	/deep/.cu-form-group uni-picker::after {
		display: none !important;
	}

	/deep/.bg-gradual-pink {
		background-image: linear-gradient(45deg, #ff0000, #cc1c1c);
	}

	.qianphotobox {
		text-align: center;
		font-size: 18px;
		color: red;
		margin-top: 20px;
	}

	.miniQrbox {
		float: left;
		width: 100%;
		text-align: center;
		font-size: 13px;
		color: #999;
		margin-top: 20px;

		.miniQr {
			width: 100%;
			padding: 10px;
		}
	}
	.information{
		position: fixed;
		right: 6px;
		writing-mode: tb-rl;
		top: 50%;
		padding: 4px 2px;
		background-color: #cc1c1ce0;
		color: white;
	}
	.serh{
		    width: 100%;
		    display: flex;
			background-color: white;
			/deep/.cu-form-group{
				padding-left: 10px;
			}
			.uni-searchbar,.saix{
				flex: 1;
			}
			.saix{
				display: flex;
				align-items: center;
				justify-content: center;
			}
	}
</style>
